<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<Script>
    /**
     *Math.random()取值范围  0<= reult <1的小数 
     * 
     * 
     * 
     * 如果希望变换随机值的范围，可以乘以对应的值
     */

    var result = Math.random();
    console.log(result);

    var arr = ["hello", "hehehe","dsgsfgs"];

    var index = result * arr.length;
    index = parseInt(index);
    console.log(arr[index]);
</Script>
</html>